<?php
namespace Amis\dataviewer;

use Amis\Basics\AmisBasics;

class ListsItem extends AmisBasics
{
    /**
     * 标题
     * @param string $title
     * @return $this
     */
    public function title(string $title)
    {
        $this->title = $title;
        return $this;
    }

    /**
     * 标题 CSS 类名
     * @param string $titleClassName
     * @return $this
     */
    public function titleClassName(string $titleClassName = 'h5')
    {
        $this->titleClassName = $titleClassName;
        return $this;
    }

    /**
     * 副标题
     * @param string $subTitle
     * @return $this
     */
    public function subTitle(string $subTitle)
    {
        $this->subTitle = $subTitle;
        return $this;
    }

    /**
     * 图片地址
     * @param string $avatar
     * @return $this
     */
    public function avatar(string $avatar)
    {
        $this->avatar = $avatar;
        return $this;
    }

    /**
     * 图片 CSS 类名
     * @param string $avatarClassName
     * @return $this
     */
    public function avatarClassName(string $avatarClassName = 'thumb-sm avatar m-r')
    {
        $this->avatarClassName = $avatarClassName;
        return $this;
    }

    /**
     * 描述
     * @param string $desc
     * @return $this
     */
    public function desc(string $desc)
    {
        $this->desc = $desc;
        return $this;
    }

    /**
     * 内容容器，主要用来放置非表单项组件
     * @param mixed ...$desc
     * @return $this|\Amis\dataviewer\ListsItem
     */
    public function body(...$desc)
    {
        $this->set(__FUNCTION__,...$desc);
        return $this;
    }

    /**
     * 按钮区域
     * @param ...$actions
     * @return $this
     */
    public function actions(...$actions)
    {
        $this->set(__FUNCTION__,...$actions);
        return $this;
    }

    public function actionsPosition(bool $isRight = true)
    {
        $this->actionsPosition = $isRight ?: 'left';
        return $this;
    }
}